ZGREP version 3.0 by Douglas E. MacLean 2200 Ocean Ave. Apt 6B Brooklyn, New York 11229 How many times did you ever want to search through a directory full of ZIP files but you couldn't exactly remember the name of the file you wanted? With ZGrep you can bring the power of Unix style regular expressions to assist in your search. Or perhaps you would like to only unzip a series of files with certain characters in the name. ZGrep is just the utility to use. Regular expressions are search patterns were certain special character are expanded to limit and guide the search. ZGrep uses these regular expressions to search ZIP and self extracting EXE files for exactly the files you want. The zip program is limited to the use of DOS wildcards to perform its operations. Now with ZGrep you can expand the usefulness of this powerful tool. The use of Zgrep is very easy. People familiar with the uniz grep program will be abile to use it right away. The command line is as follows. zgrep <-flags> regexp<,regexp...>|#refile -l: full listing -z: list only zip file name -f: list only file name -i: list only files/zips that do not match -v: verbose mode: show stats -0: check for version 0.92 exe files -1: check for version 1.02 exe files -2: check for version 1.10 exe files -h: help with regular expressions -n: the name of zip and matching files -u unzip files to path, use '.' for current dir -a: ask before unzipping file @listfile may be used to specify a list of files to search #refile may contain a list of regular expressions to use zgrep returns an errorlevel of 0 if files are found and 1 if no files are located -l full listing This option provides the full path of the zip file where the match occurred. The time, date and size of the original files are also displayed. This is the default mode. -z zip files only This options only displays the name of the zip files that contain matches for the regular expression. -f files only This will list the names of the files that match. On information about which zip file are displayed. -i inverse match This will invert the selection displaying only those files that don't match the regular expression. -n name list mode This will provide the name of the zip file and the file that matches the selection criteria. -v verbose mode This will display additional information such as the date, time and size of the matching files. -0 PKZ092 mode (self extraction) This options permits ZGrep to work on self extracting exe files created by PKZip versions prior to the 1.0x versions. Self extracting exe files from versions 1.10 is the default setting. -1 PKZ102 mode (self extraction) This options permits ZGrep to work on self extracting exe files created by PKZip versions 1.01 and 1.02 -2 PKZ110 mode (self extraction) This options permits ZGrep to work on self extracting exe files created by PKZip versions 1.10 Self extracting exe files from versions 2.0c is the default setting. -h help display This will display a chart of the options for ZGrep. -u unzip located files This will unzip the located files to the specified path. The path should appear directly after the u and may include a drive. zgrep -ud:\work ^[A-D] *.* Will unzip all files that begin with the letter A through D to the D drives work directory. -a ask first This option will prompt you for a 'y' or 'n' to determine if the displayed file show be unzipped. With version 2.0 you can now specify the files to search in a file. The file must be proceeded by the character '@' such as: zgrep ^[A-D],TXT$ @filelist You can use any combination of wildcards, filelists and filenames to designate the search list: zgrep ^[A-D],TXT$ zippy.zip @filelist a:programs Notice that if the extent zip is not specified it is assumed. With version 2.1 there is also the ability to obtain the regular expressions from a file. The file must be preceeded by the character '#': zgrep #express.lst @files The expression file and search file should have one entry per line. There may be mulitple search files but only one expression file. With version 3.0 errorlevel accessible return codes may be used in batch files. If a file is found the errorlevel is set to 0. If no files are located, a 1 is returned. You can select your own defaults by setting the DOS environment variable ZGREP. For example, set ZGREP=nv Will default to a verbose listing of zip and file names. You can also use zgrep to extract files from different zip files: zgrep -u. EXE$,DOC$ a:v9n04.zip d:\zipfiles\list73a.zip This command will extract to the current directory all *.DOC and *.EXE files from the listed zip files. History * * Rev 3.0 08 Jan 1993 16:19:24 Doug MacLean * Added return of errorlevel on exit * Updated for PKZip v2.0c Self-Extracting EXE files * * Rev 2.3 02 Jul 1991 12:46:56 DEM * Rearranged code to increase speed * Moved code from main function to increase optimization * * Rev 2.2 19 May 1990 12:05:26 DEM * Modified for MSC v6.0 usage * * Rev 2.1 17 Mar 1990 17:44:15 DEM * Added ability to obtain regular expressions from a file. * * Rev 2.0 16 Mar 1990 20:23:00 DEM * Added ability to use a list file to designate search files. * Corrected error encounted when file specified does not exist * Thanks to John McNamara or Mac's Place BBS (919) 891-1111 * who sugested the filelist idea. * * Rev 1.6 14 Mar 1990 09:38:00 DEM * The filename extent now defulats to ZIP if none is provided. * You can use a command like * zgrep ^ZGREP a:programs * to refer to a:programs.zip * * Rev 1.5 23 Mar 1990 10:04:32 DEM * Added code to support PKZ110 new EXE format. * * Rev 1.4 01 Mar 1990 15:47:16 DEM * Removed code that can be supplied from personal library * Removed redundant external prototyping * Added version number in usage display * * Rev 1.3 02 Feb 1990 17:18:24 DEM * Corrected code to permit multiple option flags * Added environmental defaults * First offical public release * * Rev 1.2 02 Feb 1990 13:29:50 DEM * Added code to unzip located files to given path * Added call to getopt() * * Rev 1.1 31 Jan 1990 22:32:52 DEM * Added online help for regular expressions * * Rev 1.0 31 Jan 1990 16:20:10 DEM * Initial revision. */ If you find this program useful, please register. The cost is $15. This includes full support, the next release and a sampler pack of other Unix4DOS programs that I am sure you will find useful. The author may be contacted via the following RIME conferences: 'C' Programming Object Oriented Programming ASM Programming Brief Editor Support Biology Conference IDC (TCXL) Support Systems Design Boyan Support Cancer Support "I host all of the above!" Thanks in advance for your support.